package utils

import (
	"crypto/sha1"
	"fmt"
	"sort"
	"strings"
)

const (
	token = "35ff5a53-99fd-4829-b16c-376217f8d320" // 替换为你在公众平台设置的Token
)

func InitWechat(signature, timestamp, nonce string) bool {
	strs := []string{token, timestamp, nonce}
	sort.Strings(strs)
	str := strings.Join(strs, "")
	sha1Str := fmt.Sprintf("%x", sha1.Sum([]byte(str)))
	return sha1Str == signature
}
